package org.study.dsm.pool.config;

import com.alibaba.druid.spring.boot3.autoconfigure.DruidDataSourceBuilder;
import com.zaxxer.hikari.HikariDataSource;
import org.apache.commons.dbcp2.BasicDataSource;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.stone.beecp.BeeDataSource;

import javax.sql.DataSource;

/**
 * 作用描述
 *
 * @author doveylovey
 * @version v1.0.0
 * @email 1135782208@qq.com
 * @date 2024年08月08日
 */
@Configuration
public class DataSourceConfig {
    @Bean("druidDataSource")
    @ConfigurationProperties("spring.datasource.druid")
    public DataSource druidDataSource() {
        return DruidDataSourceBuilder.create().build();
    }

    @Bean("hikariDataSource")
    @ConfigurationProperties("spring.datasource.hikari")
    public DataSource hikariDataSource() {
        return new HikariDataSource();
    }

    @Bean("beeDataSource")
    @ConfigurationProperties("spring.datasource.bee")
    public DataSource beeDataSource() {
        return new BeeDataSource();
    }

    @Bean("dbcp2DataSource")
    @ConfigurationProperties("spring.datasource.dbcp2")
    public DataSource dbcp2DataSource() {
        return new BasicDataSource();
    }
}
